home *** CD-ROM | disk | FTP | other *** search
- Path: su2.muelec.fpms.ac.BE!not-for-mail
- From: Jean-Marc Bourguet <bourguet@muelec.fpms.ac.be>
- Newsgroups: comp.lang.c
- Subject: Re: Object Oriented programming in C ????
- Date: 07 Mar 1996 11:23:28 +0100
- Organization: Faculte Polytechnique de Mons, Service d'Electronique
- Sender: bourguet@su2
- Message-ID: <sgbum9nqvz.fsf@su2>
- References: <4higq7$5j2@sidhe.memra.com>
- <4hkor1$3pu@dfw-ixnews1.ix.netcom.com>
- NNTP-Posting-Host: su2.muelec.fpms.ac.be (193.190.210.14)
- X-Access: 16 727
- In-reply-to: a1s@ix.netcom.com's message of Wed, 06 Mar 1996 22:18:27 GMT
- X-Newsreader: Gnus v5.0.12
-
- a1s@ix.netcom.com (Andrew Snyder) writes
- >
- > michael@memra.com (Michael Dillon) wrote:
- >
- > >Does anyone know of resources that explain how to write OO programs in C?
- > >I know about C++ and Objective C and I don't like either one. I would
- > >like to be able to write OO programs in straight C (with some
- > >preprocessor help for syntactic sugar) so that my code is fully portable
- > >between a number os OS's.
- >
- > There is no magic to OO design that requires a particular language,
- > all you need to do is hide the implementation of your "objects" behind
- > a set of function calls. The file handling provided by "stdio.h" is a
- > good example:
- >
- > 1) All possible operations on files map to a paticular function call.
- > 2) The detail of files are "hidden" from the user-programmer.
- > 3) Files can be different things on different systems (i.e. disk file,
- > pipe, tape drive)
- >
- > What an OO language will get you is better support for things like
- > initialization, real information hiding, type checking, etc.
-
- OO languages provide more than data abstraction... What is important
- for me in OO language is
- - inheritance : the possibility to define derivative of a type
- (class in the C++ terminology) and to use derivative everywhere the
- base type may be used;
- - late binding : the possibility to use functions which depend on
- the true type of one parameter (virtual methods in the C++
- terminology).
-
- > Just build a function library and hide as much stuff as you can with
- > static variables. Be sure to include the libraries header file in
- > every c file to catch errs.
- --
- Jean-Marc Bourguet Service d'Electronique
- Faculte polytechnique de Mons
- Email : bourguet@muelec.fpms.ac.be Mons, Belgique
-